package com.wfh.aigenerator.core.parser;

import com.wfh.aigenerator.common.ErrorCode;
import com.wfh.aigenerator.exception.BusinessException;
import com.wfh.aigenerator.model.enums.CodeGenTypeEnums;

/**
 * @Title: CodeParserExector
 * @Author wangfenghuan
 * @Package com.wfh.aigenerator.core.parser
 * @Date 2025/7/29 21:58
 * @description:
 */
public class CodeParserExector {

    public static Object execParser(String codeContet, CodeGenTypeEnums codeGenTypeEnums){
        return switch (codeGenTypeEnums){
            case HTML -> new HtmlCodeParser().parseCode(codeContet);
            case MULTI_FILE -> new MultiFileCodeParser().parseCode(codeContet);
            default -> throw new BusinessException(ErrorCode.PARAMS_ERROR);
        };
    }
}
